import 'package:flutter/cupertino.dart';
import 'package:client/common/event.dart';
import 'package:client/model/chatroom_msg_model.dart';

class ChatroomInfoProvider extends ChangeNotifier {
  late List<ChatroomMsgModel> _list = [];

  ChatroomInfoProvider() {
    bus.on(EventBusSet.chatroomMsg, (arg) {
      addItem(arg as ChatroomMsgModel);
      bus.emit(EventBusSet.sound);
      notifyListeners();
    });
  }

  init() {
    _list = [];
  }

  addItem(ChatroomMsgModel info) {
    _list.add(info);
  }

  List<ChatroomMsgModel> getList() {
    return _list;
  }
}
